<template>
    <div >
        <div v-show="!isdetail && !isOnlyOne">
            <Table :dataLists="dataLists" @tableLiTap="tableLiTap" :status="status" @refresh="refresh"></Table>
            <!--分页-->
            <PageDevice :pageCount="pageCount"
                        @currentChange="currentChange"
                        v-show="dataLists[0].post_title"
                        :currentPage="currentPage"></PageDevice>
        </div>
        <!--详情-->
        <div v-show="isdetail" class="fs14">
            <div class="pl29 pr30">
                <p class="fs26 c333 lh40 textc pt38" v-html="details.post_title"></p>
                <p class="fs14 c999 lh20 textc bbeee pt25 pb35">
                    <span class="pr25" v-html="'更新时间：'+details.post_modified"></span>
                    <span v-html="'来源:'+details.post_source" v-show="details.post_source"></span>
                </p>
            </div>
            <div class="w100p ovh pl45 pt60 pr43 ars" v-html="details.post_content+'<br>'"></div>
            <div class="textr w100p fs12 c999 pr43 pt60" v-if="status == 1">
                <el-button type="danger" size="small" plain @click.stop="expectedTrend(1,details.id)" title="看涨">
                    <span class=" ">
                        <b class="iconfont icon-zhang fs18px fwbold"></b>
                        <b v-html="details.up"></b>
                    </span>
                </el-button>
                <el-button type="success" size="small" plain @click.stop="expectedTrend(2,details.id)" title="看跌">
                     <span class=" ">
                    <b class="iconfont icon-die fs18px"></b>
                    <b v-html="details.down"></b>
                </span>
                </el-button>
                <el-button type="info" size="small" plain @click.stop="expectedTrend(3,details.id)" title="看平">
                    <span class="curpointer ">
                        <b class="iconfont icon-icon18 fs18px"></b>
                        <b v-html="details.flat"></b>
                    </span>
                </el-button>
            </div>
        </div>
        <div v-show="isOnlyOne" class="fs14">
            <div class="pl29 pr30">
                <p class="fs26 c333 lh40 textc pt38" v-html="dataLists[0].post_title" v-show="dataLists[0].post_title"></p>
                <p class="fs14 c999 lh20 textc bbeee pt25 pb35">
                    <span class="pr25" v-html="'更新时间：'+dataLists[0].post_modified"></span>
                    <span v-html="'来源:'+dataLists[0].post_source" v-show="dataLists[0].post_source"></span>
                </p>
            </div>
            <div class="w100p ovh pl45 pt60 pr43 ars" v-html="dataLists[0].post_content+'<br>'"></div>
            <div class="textr w100p fs16 cfff pr43 pt60"  v-if="status == 1">
                <el-button type="danger" size="small" plain @click.stop="expectedTrend(1,details.id)" title="看涨">
                    <span class=" ">
                        <b class="iconfont icon-zhang fs18px fwbold"></b>
                        <b v-html="details.up" class="fs28"></b>
                    </span>
                </el-button>
                <el-button type="success" size="small" plain @click.stop="expectedTrend(2,details.id)" title="看跌">
                     <span class=" ">
                    <b class="iconfont icon-die fs18px"></b>
                    <b v-html="details.down"></b>
                </span>
                </el-button>
                <el-button type="info" size="small" plain @click.stop="expectedTrend(3,details.id)" title="看平">
                    <span class="curpointer ">
                        <b class="iconfont icon-icon18 fs18px"></b>
                        <b v-html="details.flat"></b>
                    </span>
                </el-button>
            </div>
        </div>
    </div>
</template>

<script>
    import Table from './Table'
    import PageDevice from './PageDevice'

    export default {
        name: "Zhibo",
        props:['isdetail','dataLists','pageCount','isOnlyOne','status','currentPage'],
        components:{Table,PageDevice},
        data(){
            return{
                details:'',
                text:''
            }
        },
        created(){
            this.details = this.dataLists[0];
        },
        methods:{
            currentChange(page){
                this.$emit('currentChange',page);
            },
            tableLiTap(index){//选择进入详情
                this.details = this.dataLists[index];
                this.$emit('detailTap',index);
            },
            getSingleDetail(three_id){
                var v = this,
                    ajaxUrl = '/index.php?g=portal&m=index&a=get_new_content',
                    params = new FormData();
                params.append('id',three_id);
                v.$axios.post(ajaxUrl,params)
                    .then((res) => {
                        v.mainshow = 1;
                        res = res.data;
                        if (res.result == 1) {
                            v.details = res.data;
                        }else {
                            v.$message.error(res.msg || '获取失败！');
                        }
                    }).catch((err) => {
                    v.mainshow = 1;
                    v.$message.error('获取失败！');
                });
            },
            refresh(){
                this.$emit('refresh')
            },
            expectedTrend(status,id){ // 1--看涨 2 -- 看跌 3 -- 看平
                var v =this;
                this.$ExpectedTrends(status,id,function () {
                    v.$emit('refresh');
                });
            }
        }
    }
</script>

<style>
    .ars img{
        max-width: 100% !important;
    }
    button.el-button--mini, .el-button--small{
        font-size: 16px !important;
    }
</style>




























